package design.patterns.behavioral.templatemethod;

/**
 * @author gjx
 * @version v1.0
 * @Description
 * @date 2019/4/10 13:39
 */
public abstract class CustomCalculator {

    public final void doCalculate(int i,int j){
        int a = SUM(i,j);
        if(needShow()) {
            show(a);
        }
        save(a);

    }

   abstract void save(int a);

   abstract void show(int a);

    private int SUM(int i, int i1) {
        return i+i1;
    }

    //狗子方法
    protected boolean needShow(){
        return false;
    }
}
